<template>
  <div>
    <section class="main">
      <input
        id="toggle-all"
        class="toggle-all"
        type="checkbox"
        @click="allChecked"
       
      />
      <label for="toggle-all">Mark all as complete</label>
      <ul class="todo-list" v-for="(item, index) in list" :key="item.id">
        <!-- 当任务已完成，可以给 li 加上 completed 类，会让元素加上删除线 -->
        <li>
          <div class="view">
            <input
              class="toggle"
              type="checkbox"
              @click="alterStatues(item.id, index)"
              :checked="item.statues"
            />
            <label>{{ item.name }}</label>
            <button class="destroy" @click="delList(item.id)"></button>
          </div>
        </li>
        <!--  <li>
          <div class="view">
            <input class="toggle" type="checkbox" @click="changeStatues" />
            <label>行万里路</label>
            <button class="destroy"></button>
          </div>
        </li> -->
      </ul>
    </section>
  </div>
</template>

<script>
export default {
  name: 'body-page',
  props: {
    list: {
      type: Array,
      require: true
    }
  },
  components: {},
  data () {
    return {
      flag: false
    }
  },
  methods: {
    alterStatues (id, index) {
      this.$emit('alterStatues', (id, index))
      this.flag = !this.flag
    },
    delList (id) {
      this.$emit('delList', id)
    },
    allChecked () {
      this.$emit('allChecked')
    }
  },
  mounted () {},
  watch: {},
  computed: {},
  filters: {}
}
</script>

<style scoped lang="less"></style>
